#include "my_head.h"

bool UserInsert(p_user_node head)
{
    if(head==NULL)
    {
        printf("error\n");
        return false;
    }
    p_user_node newnode=calloc(1,sizeof(user_node));
    if(newnode==NULL)
    {
        printf("%s %d error\n",__FUNCTION__,__LINE__);
        return false;
    }
    p_user_node p=head;
    p_user_node x=head->next;
    while(x!=NULL)
    {
        x=x->next;//目标位置的后一位
        p=p->next;//目标位置
    }
    newnode->next=p->next;
    p->next=newnode;

    printf("请添加新用户角色:\n");
    scanf("%s",newnode->data.user_role);
    printf("请添加新用户用户名:\n");
    scanf("%s",newnode->data.user_name);
    printf("请添加新用户账号:\n");
    scanf("%d",&(newnode->data.user_account.id));
    printf("请添加新用户密码:\n");
    scanf("%s",newnode->data.user_account.password);  
    printf("请添加新用户权限:\n");
    scanf("%d",&(newnode->data.user_account.permission));

    printf("新用户信息添加成功！\n");
    printf("=============\n");
    return true;

}